VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmReminders 
   BackColor       =   &H00F7D9C2&
   BorderStyle     =   0  'None
   Caption         =   "Reminders"
   ClientHeight    =   6150
   ClientLeft      =   0
   ClientTop       =   15
   ClientWidth     =   10380
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmReminders.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   6150
   ScaleWidth      =   10380
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton cmdExit 
      Caption         =   "E&xit"
      Height          =   345
      Left            =   8790
      TabIndex        =   2
      Top             =   5685
      Width           =   1245
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H00F7D9C2&
      Caption         =   "Transaction Details"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   9.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   5280
      Left            =   60
      TabIndex        =   0
      Top             =   45
      Width           =   10230
      Begin MSComctlLib.ListView lvwReminders 
         Height          =   4845
         Left            =   120
         TabIndex        =   1
         Top             =   300
         Width           =   9975
         _ExtentX        =   17595
         _ExtentY        =   8546
         View            =   3
         LabelWrap       =   -1  'True
         HideSelection   =   -1  'True
         FullRowSelect   =   -1  'True
         GridLines       =   -1  'True
         _Version        =   393217
         ForeColor       =   -2147483640
         BackColor       =   -2147483643
         BorderStyle     =   1
         Appearance      =   0
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         NumItems        =   0
      End
   End
End
Attribute VB_Name = "frmReminders"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'IT Group Inc. 2005.09.23

Option Explicit

'Form mode enumeration
Enum eREMode
    Normal
    AddNewEdit
    Find
End Enum
Public Mode As eREMode

Private connList As ADODB.Connection

'Object variables

'Other declaration
Public sBit As String
Dim nIndex As Integer
Dim sFld, sFormat, sFmtFld As Variant

Public Sub cmdExit_Click()
    Unload Me
End Sub

Private Sub Form_Activate()
    BitVisible ITGLedgerMain.tbrMain
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = False
    Set FrmName = Me
End Sub

Private Sub Form_Load()
    Set FrmName = Me
    FormSetup
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , , , , True
    BitVisible ITGLedgerMain.tbrMain, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = False
    
    SetupReminders
    Remind_Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
    
    CloseMenuTab ITGLedgerMain
    
    BitEnabled ITGLedgerMain, Me, ITGLedgerMain.tbrMain, , , , , , , , , , True
    BitVisible ITGLedgerMain.tbrMain
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = False
    
'    Me.Tag = "Close"
    Set frmReminders = Nothing
    
    lCloseWindow = True
    
    
'    'oForm(Me.Tag).Mode = 1
'    'oForm(Me.Tag).Tag = Me.Tag
End Sub

Sub Remind_Me()
Set rs = Nothing
Set rs = New ADODB.Recordset
Dim rsGet As New Recordset

lvwReminders.ListItems.Clear

'sSQL = "Select * from TASKS WHERE cEmployeeID='" & SecUserID & "' AND cStatus <> 'Completed'"
If SecUserRole = "ADMIN" And SecUserRole = "FINANCE" And SecUserRole = "CEO" Then
    sSQL = "exec erp_sp_ReminderWOParam"
Else
    sSQL = "exec erp_sp_Reminder '" & SecUserID & "', '" & COID & "'"
End If
rsGet.Open sSQL, cn, adOpenKeyset, adLockReadOnly

sSQL = "SELECT cField, nWidth,cDataType,cFormat FROM ERP_REMINDERS_T"
If rs.State = adStateOpen Then rs.Close
rs.Open sSQL, cn, adOpenStatic, adLockOptimistic

If rs.EOF And rs.BOF Then Exit Sub

If rsGet.RecordCount <> 0 Then
    While Not rsGet.EOF
        Call SetField(rs, rsGet, "cDataType", "cFormat", "cField")
        Set itmX = lvwReminders.ListItems.Add(, , sFmtFld)
        rs.MoveNext
        For nIndex = 1 To rs.RecordCount - 1
            Call SetField(rs, rsGet, "cDataType", "cFormat", "cField")
            itmX.SubItems(nIndex) = sFmtFld & ""
            rs.MoveNext
        Next nIndex
        rs.MoveFirst
        rsGet.MoveNext
    Wend
End If

rsGet.Close
Set rsGet = Nothing

End Sub

Public Sub TBCloseWindow()
    Unload Me
End Sub

'Reload menu buttons (do not delete this sub)
Public Sub TBBitReload()
    BitVisible ITGLedgerMain.tbrMain, True, True
    ITGLedgerMain.tbrMain.Buttons("btnFind").ButtonMenus("btnFindP").Enabled = False
    BitReload ITGLedgerMain, Me, ITGLedgerMain.tbrMain, sBit
    Set FrmName = Me
End Sub

Private Sub lvwReminders_DblClick()
'If lvwReminders.SelectedItem.SubItems(5) <> "For Approval" Then
'    If lvwReminders.ListItems.Count = 0 Then Exit Sub
'    If lvwReminders.SelectedItem.SubItems(1) <> "" Then
'        lTasksFlag = "Edit-Rem"
'        frmTasks.Show 1
'    End If
'End If
End Sub

Private Sub SetupReminders()
    Set rs = Nothing
    Set rs = New ADODB.Recordset
    sSQL = "SELECT cField, nWidth FROM ERP_REMINDERS_T"
    rs.Open sSQL, cn, adOpenStatic, adLockOptimistic
    nIndex = 1
    If rs.EOF And rs.BOF Then Exit Sub
    rs.MoveFirst
    While Not rs.EOF
        Set itmX = lvwReminders.ColumnHeaders.Add(, , rs!cField)
        lvwReminders.ColumnHeaders(nIndex).Width = rs!nWidth
        nIndex = nIndex + 1
    rs.MoveNext
    Wend
End Sub

Private Function SetField(rsSetup As ADODB.Recordset, rsTask As ADODB.Recordset, _
        fieldDataType As Variant, fieldFormat, fieldToGet As Variant)
    If Trim(rsSetup(fieldDataType)) <> "General" Then
        sFormat = rsSetup(fieldFormat)
        sFld = rsSetup(fieldToGet)
        sFmtFld = Format(rsTask(sFld), sFormat)
    Else
        sFld = rsSetup(fieldToGet)
        sFmtFld = rsTask(sFld)
    End If
End Function
